import Sequelize from 'sequelize';
import { getDefaultFields } from '../utils';

module.exports = app => {
	const DataTypes = app.Sequelize;

	const Model = app.model.define('store_mini_page', {
		id: {
			type: DataTypes.INTEGER(11),
			allowNull: false,
			primaryKey: true,
			autoIncrement: true
		},
		name: {
			type: DataTypes.STRING(60),
			allowNull: false,
			comment: "页面名称"
		},
		status: {
			type: DataTypes.INTEGER({ length: 1 }).UNSIGNED,
			allowNull: true,
			defaultValue: 0,
			comment: '0-> 未发布，1-> 已发布'
		},
		sort: {
			type: DataTypes.INTEGER(11),
			allowNull: true
		},
		...getDefaultFields()
	}, {
		tableName: 'store_mini_page',
		timestamps: false
	});
	
	Model.sync({ alter: true });
	Model.associate = function() {

	}

	return Model;
};
